package com.集合.作业;

import java.util.ArrayList;

@SuppressWarnings("all")
public class h1 {
    public static void main(String[] args) {
        String title1 = "新冠确诊病例超千万数百万印度教信徒傅恒和圣域引民众担忧 ";
        String title2 = "梁子突然想起两个月前钓的鱼还在网兜里捞起一看赶紧放手 ";

        News news1 = new News(title1);
        News news2 = new News(title2);

        ArrayList list = new ArrayList();
        list.add(news1);
        list.add(news2);

        for (int i = list.size() - 1 ; i >=0 ; i--) {
            String title = list.get(i).toString();
            if (title.length() >= 15)
                title = title.substring(0,16) + "....";
            System.out.println(title);
        }

    }
}

class News{
    private String title;
    private String content;

    public News(String title) {
        this.title = title;
    }

    @Override
    public String toString() {
        return  '\n'+title ;
    }



    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}